home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-13
/
amac44d.zip
/
SRQ.QM
< prev
next >
Wrap
Text File
|
1992-06-22
|
7KB
|
129 lines
* SRQ.QM
* Search/Replace Using SRQ.BAT, Quit Each File After Replacement
* 6/8/92
*
* ----------------------------------------------------------------------
* @(5) Search/Replace From Command Line Using SRQ.BAT,
* Quit Each File After Replacement
* Can Also Remove Search Text
* ----------------------------------------------------------------------
* Often the total size of files needing a "replacement" will exceed the
* available memory when using SR.BAT with SR.QM. Macro @5 in SRQ.QM is
* simply a modification of @0 in SR.QM by replacing 'SaveFile' with
* 'File' so each file is saved then quit after replacement.
* Search/replace is performed by running SRQ.BAT.
* To do a search/replace from command line, type SR and answer prompts
* for search and replacement text. This version of this macro, a
* modification of previous versions of SR.QM, enables the user to also
* REMOVE search text by hitting <enter> at the replacement text prompt.
* Versions with Amac43.zip and prior required that some replacement
* text be entered at the replacement text prompt.
* FGREP.COM, INPUT.COM and QEdit v2.15 are required. Changing c:\ to
* your ram drive will increase speed. Please refer to SR.BAT and SR.QM
* for other details concerning entering optional parameters at the
* command line or in response to input query prompts.
@5 macrobegin
setsoundoff
altwordset * For all file names
cursordown cursorup
jtrue START * Test if any search text found
* --------------- Display "No found text" Message ---------------*
MESSAGE:
"No found text" *|
jump END * If not found, display this
* -------------------------- Load Files --------------------------*
START:
endfile
LOADAGAIN:
* unmarkblock * Unmark last file name *|
setscreenon setscreenoff * To reduce flashing
find
#42 "Fi" return
"B" return * Find file name
jfalse MESSAGE * No find ?, show message, end
wordright wordright
markcolumn endline copy * Copy file name to scrap
EditFile
CurrentFilename " "
Paste Return * Load file
cursorup jtrue LOADAGAIN * Test if more filenames?
* ------------------ Get Search Text To Scratch ------------------*
editfile "c:\$" return * Load set output file
find
"S~~" return
delline return * Find S~~ in SET output
find
"=" return
delline return * Move to =
cursorright markcharacter * Mark first character
endline * Move to end of text
storescrbuff "S~~" return * Store SEARCH text to scratch
* ----------------- Get Replace Text To Scratch -----------------*
unmarkblock begfile
find
"R~~" return
delline return * Find
jtrue FOUND * If found, we specified replacement text*|
endline markcolumn * If not, make empty block to clear buff *|
jump BLANK *|
FOUND: *|
find
"=" return
delline return * Move to =
cursorright markcharacter * Mark first character
endline * Move to end of text
BLANK: *|
storescrbuff "R~~" return * Store REPLACE text to scratch
* killfile quit * Kill/quit c:\$ *|
* ---------------------- Do Search/Replace ----------------------*
* Editfile "NUL" Return * Load NUL File *|
getscrbuff "S~~" return
cut * Cut search text from scratch
Find paste Return escape * Initialize find prompt
getscrbuff "R~~" return
cut * Cut replace text from scratch
FindReplace
return paste return * Begin replacement
"GIN" * Replace options
* pause ** Add this to pause for options
return * MUST include "GIN"
killfile quit * Kill/quit c:\$ *|
* ---------------- Load Files, Do Search/Replace ----------------*
Begfile Cursorright * Put cursor in col 2 c:\! *|
* Begline Cursorright * Put cursor in col 2 *|
setscreenon *|
LOOP:
Nextfile
Cursorleft Jfalse DOIT
Cursorleft Jfalse ENDLOOP
DOIT: * FindReplace Loop
BegFile * Move up in case cursor is below find
Repeatfind * Do the FindReplace
Jtrue SAVE * If CHANGES are made -- SAVE the File
Quit * If NO CHANGES are made -- QUIT the file
Jump LOOP * Return to the Main Loop
SAVE: * Routine to Save a File with Changes
FILE * Save and quit this file after rplcmnmt
Jump LOOP * Return to Main Loop
ENDLOOP: * Loop is DONE
Quit * Quit c:\!, only file left in ring
editfile escape * If Qconfig set to edit prompt on quit *|
END:
* defaultwordset *|
*
* 153 bytes Tue 10-02-1990 18:50:33
* 200 bytes Thu 04-25-1991 12:02:23 added "No found text" message
* added "GIN" auto replace option
* changed file "_" to NUL", faster
* changed "c:" to "c:\"
* 208 bytes Tue 04-30-1991 22:16:22 changed search and replace to scrap
* 211 bytes Wed 04-15-1992 17:55:38 (TH @4, for QEdit v2.15)
* 211 bytes Wed 04-22-1992 00:15:22 (TH @5, changed key)
* (In Amac42e.zip)
* 209 bytes Mon 06-01-1992 17:04:36 (TH @5, will remove search text *|)